﻿using System.Collections.Generic;
using System.Linq;
using RestSharp;
using Ymatou.API.Common;
using Ymatou.Evaluate.Buyer.Model.ApiModel.Response.Query;
using Ymatou.ServiceCenter;

namespace Ymatou.Evaluate.Buyer.Model.ApiModel.Request.Query
{
    /// <summary>
    /// 获取订单评价状态
    /// </summary>
    [Resource("bevaluateq.iapi.ymatou.com", "api/GetOrdersEvalStatus", Method.POST, ParameterBuildType.Json)]
    public class GetOrdersEvalStatusRequest : BaseRequestModel<GetOrdersEvalStatusResponse>
    {
        public override string ApiName { get { return "api/GetOrdersEvalStatus"; } }
        public override bool HttpGet { get { return false; } }

        /// <summary>
        /// 买家Id
        /// </summary>
        public int BuyerId { get; set; }

        /// <summary>
        /// 订单Id集合
        /// </summary>
        public List<int> OrderIds { get; set; }

        public override void Validate()
        {
            const string errCode = "-1";
            if (BuyerId <= 0)
            {
                throw new BussniessException(errCode, "非法买家Id");
            }
            if (OrderIds == null || OrderIds.Count <= 0)
            {
                throw new BussniessException(errCode, "订单Id不能为空");
            }
            OrderIds = OrderIds.Distinct().ToList();
            base.Validate();
        }
    }
}
